<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>QUnit Example</title>
        <link rel="stylesheet" href="./qunit-1.5.0.css">
        
    </head>
    <body>
        <h1>Parse Game</h1>
        <div id="qunit"></div>
         <div id="qunit-fixture"></div>
        <script src="./qunit-1.5.0.js"></script>
        <script src="./../Game/GameModels.js"></script>
        <script src="../jquery-1.4.4.js"></script>

<script>


test( "Parse Field 1", function() {
    
    
    var $fixture = $( "#qunit-fixture" );
        $fixture.append( '<div class="gameField" id="2_1">' );
    
    var parser = new BattleThis.JQueryParser();
    var result = parser.ParseFields();    
    
    equal(result["2_1"].row , 1, "row is wrong");
    equal(result["2_1"].column , 2, "column is wrong");
});
   
test( "Parse Field 2", function() {
    
    
    var $fixture = $( "#qunit-fixture" );
        $fixture.append( '<div class="gameField" />' );
    
    var parser = new BattleThis.JQueryParser();
    var result = parser.ParseFields();    
    
    equal(result["1_1"] , undefined, "no value");
});

test( "Parse Field 3", function() {
    
    
    var $fixture = $( "#qunit-fixture" );
        $fixture.append( '<div class="gameField" id="1_2" />' );
        $fixture.append( '<div class="gameField"  id="1_3" />' );
    
    var parser = new BattleThis.JQueryParser();
    var result = parser.ParseFields();    
    
    equal(result["1_2"].row , 2, "row is wrong");
    equal(result["1_2"].column , 1, "column is wrong");
    equal(result["1_3"].row, 3, "row is wrong");
    equal(result["1_3"].column, 1, "column is wrong");
});
   
</script>
           
    </body>
</html>
